| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | var assert = require('assert'), |
||
| 10 | KeyDerivation.compute = function(pw, salt, iterations) { |
||
| 11 | iterations = iterations || this.defaultIterations; |
||
| 12 | assert(pw instanceof Buffer, 'Password must be provided as a Buffer'); |
||
|
|
|||
| 13 | assert(salt instanceof Buffer, 'Salt must be provided as a Buffer'); |
||
| 14 | assert(salt.length > 0, 'Salt must not be empty'); |
||
| 15 | assert(typeof iterations === 'number', 'Iterations must be a number'); |
||
| 16 | assert(iterations > 0, 'Iteration count should be at least 1'); |
||
| 17 | |||
| 18 | if (salt.length > 0x80) { |
||
| 19 | throw new Error('Sanity check: Invalid salt, length can never be greater than 128'); |
||
| 20 | } |
||
| 21 | |||
| 22 | return pbkdf2Sha512.digest(pw, salt, iterations, this.keySizeBits / 8); |
||
| 23 | }; |
||
| 24 | |||
| 26 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.